import subprocess
import sys

# 获取命令行参数
# dataset = sys.argv[1]
# model = sys.argv[2]
# seedfile = sys.argv[3]
# output_dir = sys.argv[4]
dataset = "humaneval"
model = "gpt-3.5-turbo-0613"
seedfile = f"input_data/{dataset}/seed/{model}/seed.jsonl"
output_dir = "outputs"

# 定义其他参数
strategy = "ldb"
run_name = output_dir
root_dir = f"../output_data/{strategy}/{dataset}/{model}/"
dataset_path = f"../input_data/{dataset}/dataset/probs.jsonl"
testfile = f"../input_data/{dataset}/test/tests.jsonl"
pass_at_k = "1"
max_iters = "10"
n_proc = "1"
port = "8000"
verbose = True  # 假设verbose为True，如果需要根据参数调整，可以添加一个参数

# 构建命令
command = [
    "python", "main.py",
    "--run_name", run_name,
    "--root_dir", root_dir,
    "--dataset_path", dataset_path,
    "--strategy", strategy,
    "--model", model,
    "--seedfile", seedfile,
    "--pass_at_k", pass_at_k,
    "--max_iters", max_iters,
    "--n_proc", n_proc,
    "--port", port,
    "--testfile", testfile
]

if verbose:
    command.append("--verbose")

# 执行命令
try:
    subprocess.run(command, check=True)
except subprocess.CalledProcessError as e:
    print(f"An error occurred while executing the command: {e}")